#!/bin/zsh

npm install --force

npm run build

DATE_FORMAT=$(date +%Y%m%d.%H%M.%S)
TAG="web-$DATE_FORMAT"

# 构建镜像并获取镜像 ID
echo ">>> 执行镜像构建 ai-treasure-chest-web:$TAG"
IMAGE_ID=$(docker build --platform linux/amd64 -q -t ai-treasure-chest-web:"$TAG" .)

# 打标签
echo ">>> 执行镜像打标，tag=$TAG"
docker tag "$IMAGE_ID" registry.cn-hangzhou.aliyuncs.com/hongmin_image_registory/ai-treasure-chest-web:"$TAG"

# 推送到私有仓库
echo ">>> 推送镜像至私有仓库"
docker push registry.cn-hangzhou.aliyuncs.com/hongmin_image_registory/ai-treasure-chest-web:"$TAG"

echo ">>> SUCCESS 镜像推送完成，ai-treasure-chest-web tag=$TAG"

